<clr-datagrid (clrDgRefresh)="refresh($event)">
  <clr-dg-column >
    <ng-container *clrDgHideableColumn="showState['ID']">
      ID
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'user.name'" *ngIf="listType === 'namespace'">
    <ng-container *clrDgHideableColumn="showState['用户名称']">
      用户名称
    </ng-container>
  </clr-dg-column>
  <clr-dg-column [clrDgField]="'namespace.name'" *ngIf="listType === 'user'">
    <ng-container *clrDgHideableColumn="showState['命名空间名称']">
      命名空间名称
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['所属群组']">
      所属群组
    </ng-container>
  </clr-dg-column>
  <clr-dg-column>
    <ng-container *clrDgHideableColumn="showState['创建时间']">
      创建时间
    </ng-container>
  </clr-dg-column>
  <clr-dg-column
      *ngIf="authService.currentNamespacePermission.namespaceUser.update || authService.currentNamespacePermission.namespaceUser.delete ||  authService.currentUser.admin"
    >
    <ng-container *clrDgHideableColumn="showState['操作']">
      操作
    </ng-container>
  </clr-dg-column>
  <clr-dg-row *ngFor="let namespaceUser of namespaceUsers" [clrDgItem]="namespaceUser">
    <clr-dg-cell>{{namespaceUser.id}}</clr-dg-cell>
    <clr-dg-cell *ngIf="listType === 'namespace'" class="copy">{{namespaceUser.user.name}}</clr-dg-cell>
    <clr-dg-cell *ngIf="listType === 'user'" class="copy">{{namespaceUser.namespace.name}}</clr-dg-cell>
    <clr-dg-cell>{{namespaceUser.groupsName }}</clr-dg-cell>
    <clr-dg-cell>{{namespaceUser.createTime | date:'yyyy-MM-dd HH:mm'}}</clr-dg-cell>
    <clr-dg-cell
      *ngIf="authService.currentNamespacePermission.namespaceUser.update || authService.currentNamespacePermission.namespaceUser.delete ||  authService.currentUser.admin"
      >
      <button class="wayne-button text"
        *ngIf="authService.currentNamespacePermission.namespaceUser.update || authService.currentUser.admin"
        (click)="editNamespaceUser(namespaceUser)">
        编辑</button>
      <button class="wayne-button text"
        *ngIf="authService.currentNamespacePermission.namespaceUser.delete || authService.currentUser.admin"
        (click)="deleteNamespaceUser(namespaceUser)">
        删除</button>
    </clr-dg-cell>
  </clr-dg-row>

  <wayne-paginate
    [(currentPage)]="currentPage"
    [total]="page.totalCount"
    [pageSizes]="[10, 20, 50]"
    (sizeChange)="pageSizeChange($event)"
  >
  </wayne-paginate>
</clr-datagrid>
